<!DOCTYPE html>
<html>

<head>
    {include file="Public/header"}
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <link rel="stylesheet" href="__STATIC__/layout/css/zTreeStyle.css" type="text/css">
    <link href="__STATIC__/layout/css/common.css" rel="stylesheet">
      <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <style>
      
        /*  .quedingbtn button{text-align: center;margin-right: 5px;margin-left: 0}*/
        .agencyM_table tr td a:hover {
            text-decoration: underline;
        }

        .agencyM_table tr td span {
            font-size: 12px;
            margin: 0 5px 0 5px;
        }

        .agencyM_table tr td .add_import {
            font-size: 12px;
            color: red;
        }

        .agencyM_table tbody tr td .textareaInfo {
            width: 100%;
            max-height: 50px;
            /*自动适应父布局宽度*/
            overflow: auto;
            word-break: break-all;
        }

        .agencyM_table tbody tr td ul li a {
            display: inline-block;
            margin: 0 8px;
            font-weight: bold;
        }

        .agencyM_table tbody .this_tableInfo_alert {
            display: none;
        }

        .H_title {
            cursor: pointer;
        }

        .da_table tr td .textW {
            max-width: 140px;
            display: inline-block;
        }

        .colorRed {
            color: red;
        }

        .da_table tr td .select2 {
            width: 100px;
            height: 26px;
        }

        .mlR {
            margin: 0 5px;
        }

        .textR {
            text-align: right;
        }
    </style>
</head>

<body class="white-bg x_sorll" style="color:#333;padding:3px;">


 <div class="page-heade clearfix">
      <h2 class="title_color text-center">
        <a class="col-md-6 title_color H_right H_active" style="font-size: 16px;" href="{:url('index')}">系统管理</a>
        <a class="col-md-6 title_color H_right" style="font-size: 16px;color:#333;" href="{:url('lianyingsystem')}">联营系统管理</a>

      </h2>
    </div>

      
        <div class="Agencycontent">
            <div class="col-md-12" style="padding: 10px 0;">
                <button class="btn btn-sm btn-info addNewSystem">添加新的系统</button>
                <!--<a class="btn btn-info lendAndNewSystem" href="{:url('lendSystem')}">导入批量更新系统</a>-->
                <!--<a class="btn btn-info plAmendSystemName"  href="{:url('plamendSystem')}">批量更改系统名称</a>-->
                <button class="btn btn-sm btn-info mapShowAllSystem">在地图上显示所有系统</button>
                <button class="btn btn-sm btn-info rubish" style="position: absolute;right: 20px;top:8px" id="isdel">回收站</button>
            </div>
            <form id="form1" action="" class="form-inline" method="get">
                <table class="table da_table table-bordered" style="margin-bottom:0;border-bottom: 0;font-size: 14px">
                    <tr>
                        <td class="textR"><label for="sn">系统编号:</label></td>
                        <td><input type="text" name="sn" value="{$sn}" id="sn" class="form-control textW"></td>
                        <td class="textR"><label for="title">系统名称:</label></td>
                        <td><input type="text" name="title" id="title" value="{$title}" class="form-control textW"></td>
                        <td class="textR"><label for="wdXianShiLeiXing">系统有多个经销商显示方法:</label></td>
                        <td><select id="wdXianShiLeiXing" class="form-control select" name="wdXianShiLeiXing">
                            <option value="0" {if $wdXianShiLeiXing=='0'}selected="selected"{/if}>系统只显示一条</option>
                            <option value="1" {if $wdXianShiLeiXing=='1'}selected="selected"{/if}>根据所属经销商（供应商）显示多条</option>
                        </select></td>
                    </tr>
                    <tr>
                        <td class="textR"><label for="zoning">经销商所属分区:</label></td>
                        <td><input type="text" id="zoning" name="zoning" value="{$zoning}" class="form-control textW"></td>
                        <td class="textR"><label for="provice">经销商所属省份:</label></td>
                        <td><input type="text" id="provice" name="provice" value="{$provice}" class="form-control textW"></td>
                        <td class="textR"><label for="city">经销商所属城市:</label></td>
                        <td><input type="text" id="city" name="city" value="{$city}" class="form-control textW"></td>
                    </tr>
                    <tr>
                        <td class="textR"><label for="zoning_head">分区负责人:</label></td>
                        <td><input type="text" name="zoning_head" value="{$zoning_head}" id="zoning_head" class="form-control textW"></td>
                        <td class="textR"><label for="provice_head">省份负责人:</label></td>
                        <td><input type="text" name="provice_head" value="{$provice_head}" id="provice_head" class="form-control textW"></td>
                        <td class="textR"><label for="stuff">业务人员:</label></td>
                        <td><input type="text" name="stuff" id="stuff" value="{$stuff}" class="form-control textW"></td>
                    </tr>
                </table>

            <div class="col-md-12 white-bg text-center" style="padding: 10px 0">
                <button class="btn btn-sm btn-info  query">查询</button>
                <button class="btn btn-sm btn-info  emptyIf" id="reset">清空查询条件</button>
                <button class="btn btn-sm btn-info  lendExcel">导出导入版Excel</button>
                <button class="btn btn-sm btn-info  lendAllExcel">导出完整版Excel</button>
            </div>
            </form>

            <!-- 表格 -->
            <div class="row-margin-top">
                <table class="table table-bordered  table-striped text-center table-hover agencyM_table bud_hei">
                    <tr class="info">
                        <th class="text-center">No.</th>
                        <th class="text-center">系统编号</th>
                        <th class="text-center">系统名称</th>
                        <th class="text-center">业务人员<br>(系统)</th>
                        <th class="text-center">所属经销商编号</th>
                        <th class="text-center">所属经销商名称</th>
                        <th class="text-center">分区<br>(经销商)</th>
                        <th class="text-center">省份<br>(经销商)</th>
                        <th class="text-center">城市<br>(经销商)</th>
                        <th class="text-center">分区负责人<br>(经销商)</th>
                        <th class="text-center">省份负责人<br>(经销商)</th>
                        <th class="text-center">城市负责人<br>(经销商)</th>
                        <th class="text-center">业务人员<br>(经销商)</th>
                        <th class="text-center">类型</th>
                        <th class="text-center">二级渠道</th>
                        <th class="text-center">一级渠道</th>
                        <th class="text-center">详细地址</th>
                        <th class="text-center">维护</th>
                    </tr>
                    {if $wdXianShiLeiXing==1}
                    {volist name="data" id="row"}
                    <tr class="angency_tableInfo">
                        <td class="NoId">{$row.id}</td>
                        <td>{$row.sn}</td>
                        <td><a href="{:url('view',array('id'=>$row.id))}" class="view11 J_menuItem" data-id="">{$row.title}</a></td>
                        <td>
                            <div class="textareaInfo">
                                {volist name="row.stuff" id="row2"}
                                <span>{$row2}</span>
                                {/volist}
                            </div>
                        </td>
                        <td>{$row.jxs}</td>
                        <td><a href="{:url('jxsgl/agencydetail',array('id'=>$row.jxs))}" class="viewjxs J_menuItem" data-id="">{$row.jxs_title}</a></td>
                        <td>{$row.zoning_title}</td>
                        <td>{$row.provice_title}</td>
                        <td>{$row.city_title}</td>
                        <td>{$row.zoning_head}</td>
                        <td>{$row.provice_head}</td>
                        <td>{$row.city_head}</td>
                        <td>
                            <div class="textareaInfo">
                            {volist name="row.jxs_stuff" id="row2"}
                            <span>{$row2}</span>
                            {/volist}
                        </div>
                        </td>
                        <td>{$row.cusType}</td>
                        <td>{$row.twoCType}</td>
                        <td>{$row.oneCType}</td>
                        <td>{$row.detailAddress}</td>
                        <td>
                            <a href="{:url('updateview',array('id'=>$row.id))}">修改</a>
                            <a href="{:url('repDealer',array('id'=>$row.id))}" class="changeAgency">更换经销商</a>
                            <a href="{:url('delete',array('id'=>$row.id))}" class="delThisTr">删除</a>
                            <a href="{:url('batchDel',array('id'=>$row.id))}" class="batchDel">批量删除系统及下属网点</a>
                        </td>
                    </tr>
                    {/volist}
                    {else}
                    {volist name="data" id="row"}
                    <tr class="angency_tableInfo">
                        <td class="NoId">{$row.id}</td>
                        <td>{$row.sn}</td>
                        <td><a href="{:url('view',array('id'=>$row.id))}" class="view11 J_menuItem" data-id="">{$row.title}</a></td>
                        <td>
                            <div class="textareaInfo">
                                {volist name="row.stuff" id="row2"}
                                <span>{$row2}</span>
                                {/volist}
                            </div>
                        </td>
                        <td></td>
                        <td>
                            {volist name="row.jxss" id="row2"}
                            {$row2.jxs_title}<br>
                            {/volist}
                        </td>
                        <td>{$row.zoning_title}</td>
                        <td>{$row.provice_title}</td>
                        <td>{$row.city_title}</td>
                        <td>{$row.zoning_head}</td>
                        <td>{$row.provice_head}</td>
                        <td>{$row.city_head}</td>
                        <td>
                            <div class="textareaInfo">

                            </div>
                        </td>
                        <td>{$row.cusType}</td>
                        <td>{$row.twoCType}</td>
                        <td>{$row.oneCType}</td>
                        <td>{$row.detailAddress}</td>
                        <td>
                            <a href="{:url('updateview',array('id'=>$row.id))}">修改</a>
                            <a href="{:url('repDealer',array('id'=>$row.id))}" class="changeAgency">更换经销商</a>
                            <a href="{:url('delete',array('id'=>$row.id))}" class="delThisTr">删除</a>
                            <a href="{:url('batchDel',array('id'=>$row.id))}" class="batchDel">批量删除系统及下属网点</a>
                        </td>
                    </tr>
                    {/volist}
                    {/if}
                </table>
                <div class="row text-center" id="pageText" style="padding: 0;margin: 0;">
					<div class="col-sm-6 text-left"><div class="padding-10 countSize">共{$count}条记录，{$maxpage}页&nbsp;&nbsp;</div></div>
					<div class="col-sm-6 text-right">{$page}</div>
				</div>

            </div>
        </div>

    <!-- 表格 -->


    <!-- 全局js -->
    {include file="Public/footer"}
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>

    <!-- 自定义js -->
    <!-- <script src="js/hplus.js?v=4.1.0"></script> -->
    <!-- <script type="text/javascript" src="js/contabs.js"></script> -->
    <!-- Peity -->
    <script src="__STATIC__/layout/js/plugins/peity/jquery.peity.min.js"></script>

    <!-- jqGrid -->
    <script src="__STATIC__/layout/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
    <script src="__STATIC__/layout/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

    <!-- 自定义js -->
    <script src="__STATIC__/layout/js/content.js?v=1.0.0"></script>
    <script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
    <!-- <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script> -->
    <!--统计代码，可删除-->
    <script src="__STATIC__/layout/js/contabs_sub.js"></script>
    <script>
        $(document).ready(function () {
            $('#reset').on('click',function () {
                $("#form1 input").each(function(){
                    $(this).val('');
                });
                $("#form1 select").each(function(){
                    $(this).val('');
                });
                $('#form1').submit()
                return false
            })
            $(".addNewSystem").click(function () {
                layer.open({
                    type: 2,
                    title: '&nbsp;',
                    shadeClose: true,
                    shade: false,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['800px', '500px'],
                    content: '{:url("addview")}'
                })
            });
            // //查看详情
            // $(".view11").click(function () {
            //     var id = $(this).data('id')
            //     var index = layer.open({
            //         type: 2,
            //         title: '&nbsp;',
            //         shadeClose: true,
            //         shade: false,
            //         maxmin: true, //开启最大化最小化按钮
            //         area: ['800px', '500px'],
            //         content: id
            //     })
            //     layer.full(index)
            //     return false
            // });

            // //查看经销商
            // $(".viewjxs").click(function () {
            //     var id = $(this).data('id')
            //     var index = layer.open({
            //         type: 2,
            //         title: '&nbsp;',
            //         shadeClose: true,
            //         shade: false,
            //         maxmin: true, //开启最大化最小化按钮
            //         area: ['800px', '500px'],
            //         content: id
            //     })
            //     layer.full(index)
            //     return false
            // });
            $(".changeAgency").click(function () {
                var link = $(this).attr('href')
                layer.open({
                    type: 2,
                    title: '&nbsp;',
                    shadeClose: true,
                    shade: false,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['800px', '500px'],
                    content: link
                })
                return false
            });

            //删除系统
            $('.delThisTr').click(function () {
                var $thisTr = $(this).attr('href')

                swal({
                    title: "确定删除吗？",
                    text: "",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "确定",
                    cancelButtonText: "返回"
                },function (ff) {
                    if(ff){
                        $.post($thisTr,function (data) {
                            if(data.success)
                                swal({
                                    title: "",
                                    text: "删除成功",
                                    type: "success"
                                },function () {
                                    location.reload()
                                })
                            else
                                swal({
                                    title: "",
                                    text: "删除失败",
                                    type: "success"
                                })
                        },'json')
                    }

                });

            })
            //批量删除系统及下属网点
            $('.batchDel').click(function () {
                var $thisTr = $(this).attr('href')

                swal({
                    title: "确定删除吗？",
                    text: "",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "确定",
                    cancelButtonText: "返回"
                },function (ff) {
                    if(ff){
                        $.post($thisTr,function (data) {
                            if(data.success)
                                swal({
                                    title: "",
                                    text: "删除成功",
                                    type: "success"
                                },function () {
                                    location.reload()
                                })
                            else
                                swal({
                                    title: "",
                                    text: "删除失败",
                                    type: "success"
                                })
                        },'json')
                    }

                });
                return false;
            });
        })

    </script>
<script>
    $('#isdel').on('click',function () {
        var index = layer.open({
            type: 2,
            title: '系统-回收站',
//                        area: ['500px', '400px'],
            fixed: false, //不固定
            maxmin: true,
            content: '{:url("isdel")}'
        });
        layer.full(index)
        return false
    })
    
    //在地图上显示
    $('.mapShowAllSystem').click(function () {
        layer.open({
            type: 2,
            title: '&nbsp;',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['800px', '500px'],
            content: '{:url("mapShow")}'
        })
        return false

    })
</script>
</body>

</html>